<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateDepartmentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('departments', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name')->unique()->comment('部门名称');
            $table->string('telephone')->default('')->comment('电话');
            $table->bigInteger('manager_id')->comment('部门管理者');
            $table->string('zip_code')->default('')->comment('邮编');
            $table->string('address')->default('')->comment('地址');
            $table->string('fax')->nullable()->comment('传真');
            $table->bigInteger('parent_id')->nullable()->comment('parent_id');
            $table->integer('order')->default('0')->comment('顺序');
            $table->string('remark')->nullable()->comment('备注');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('departments');
    }
}
